#include <stdio.h>

int main()
{
    int nCase;
    scanf("%d", &nCase);
    while (nCase-- > 0)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d %d %d %d %d\n",
                a + b, a * b, a - b,
                b == 0 ? -1 : a / b,
                b == 0 ? -1 : a % b);
    }
    return 0;
}
